<aside class="main-sidebar ">
    <section class="sidebar">
        <!-- Sidebar user panel -->
        <div class="user-panel">
            <div class="pull-left image">
                <img src="/static/js/adminlte/img/user2-160x160.jpg" class="img-circle" alt="User Image">
            </div>
            <div class="pull-left info">
                <p>${EMPLOYEE_IN_SESSION.username}</p>
                <a href="#"><i class="fa fa-circle text-success"></i>在线</a>
            </div>
        </div>
        <!-- search form -->
        <form action="#" method="get" class="sidebar-form">
            <div class="input-group">
                <input type="text" name="q" class="form-control" placeholder="Search...">
                <span class="input-group-btn">
                <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
                </button>
              </span>
            </div>
        </form>
        <ul class="sidebar-menu" data-widget="tree" id="menuList">
            <#--<li class="treeview">
                <a href="#">
                    <i class="fa fa-joomla"></i> <span>门店管理</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">

                    <li name="business"><a href="/business/list"><i class="fa fa-circle-o"></i>门店信息</a></li>
                    <li name="appointment"><a href="list"><i class="fa fa-circle-o"></i>业务预约</a></li>
                    <li name="consumption"><a href="/consumption/list"><i class="fa fa-circle-o"></i>结算单</a></li>
                    <li name="consumptionItem"><a href="/consumptionItem/list"><i class="fa fa-circle-o"></i>结算单明细</a></li>
                </ul>
            </li>
            <li class="treeview">
                <a href="#">
                    <i class="fa fa-dashboard"></i> <span>系统管理</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li name="department"><a href="/department/list"><i class="fa fa-circle-o"></i> 部门管理</a></li>
                    <li name="employee"><a href="/employee/list"><i class="fa fa-circle-o"></i> 员工管理</a></li>
                    <li name="permission"><a href="/permission/list"><i class="fa fa-circle-o"></i> 权限管理</a></li>
                    <li name="role"><a href="/role/list"><i class="fa fa-circle-o"></i> 角色管理</a></li>
                </ul>
            </li>-->
            <#--<li class="treeview">
                <a href="#">
                    <i class="fa fa-dashboard"></i> <span>公告管理</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li name="notice"><a href="/notice/list"><i class="fa fa-circle-o"></i> 公告信息</a></li>
                </ul>
            </li>

            <li class="treeview">
                <a href="#">
                    <i class="fa fa-files-o"></i>
                    <span>数据管理</span>
                    <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
                </a>
                <ul class="treeview-menu">
                    <li name="systemDictionary"><a href="/systemDictionary/list"><i class="fa fa-circle-o"></i> 字典目录</a>
                    </li>
                    <li name="systemDictionaryItem"><a href="/systemDictionaryItem/list"><i
                            class="fa fa-circle-o"></i> 字典明细</a></li>
                </ul>
            </li>

            <li class="treeview">
                <a href="#">
                    <i class="fa fa-pie-chart"></i>
                    <span>客户管理</span>
                    <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
                </a>
                <ul class="treeview-menu">
                    <li name="customer"><a href="/customer/list"><i class="fa fa-circle-o"></i> 客户列表</a></li>
                    <li name="customer_potential"><a href="/customer/potentialList"><i class="fa fa-circle-o"></i>潜在客户</a></li>
                    <li name="customer_pool"><a href="/customer/poolList"><i class="fa fa-circle-o"></i> 客户池</a></li>
                    <li name="customer_fail"><a href="/customer/failList"><i class="fa fa-circle-o"></i> 失败客户</a>
                    </li>
                    <li><a href="#"><i class="fa fa-circle-o"></i> 正式客户</a></li>
                    <li><a href="#"><i class="fa fa-circle-o"></i> 流失客户</a></li>
                </ul>
            </li>
            <li class="treeview">
                <a href="#">
                    <i class="fa fa-edit"></i>
                    <span>客户历史</span>
                    <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
                </a>
                <ul class="treeview-menu">

                    <li name="customerTraceHistory"><a href="/customerTraceHistory/list"><i
                            class="fa fa-circle-o"></i> 跟进历史</a></li>
                    <li name="customerTransfer"><a href="/customerTransfer/list"><i class="fa fa-circle-o"></i> 移交历史</a>
                    </li>
                </ul>
            </li>
            <li class="treeview">
                <a href="#">
                    <i class="fa fa-laptop"></i>
                    <span>报表统计</span>
                    <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
                </a>
                <ul class="treeview-menu">
                    <li name="customerReport"><a href="/consumptionReport/list"><i class="fa fa-circle-o"></i>结算单报表</a>
                    </li>
                </ul>
            </li>-->

           <#-- <li class="treeview">
                <a href="#">
                    <i class="fa fa-dashboard"></i> <span>菜单管理</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">
                    <li name="notice"><a href="/systemMenu/list"><i class="fa fa-circle-o"></i> 菜单编辑</a></li>
                </ul>
            </li>-->


            <script>


            </script>

        </ul>



    </section>
</aside>

<script>
    var tree="";
    var children="";
    $.get('/systemMenu/menu',function (data) {

        //console.log(data);
        /*$.each(data ,function (index,parent) {
            tree+= '<li class="treeview"><a href="#">' +
                '<i class="fa fa-dashboard"></i> <span>'+parent.name+'</span>' +
                '<span class="pull-right-container">' +
                '<i class="fa fa-angle-left pull-right"></i>' +
                '</span></a>'
                    parent += children;

                  /!*  $.each(parent.children,function (index,children) {
                       children=
                        '                <ul class="treeview-menu">\n' +
                        '                    <li name="notice"><a href="/systemMenu/list"><i class="fa fa-circle-o"></i> 菜单编辑</a></li>\n' +
                        '                </ul> </li>';
                        console.log(children);

                    });*!/


        });*/

        if (data) {
            var parent ='';
            var child = '';
            console.log(data);
            $.each(data, function (index, ele) {

                if ((ele.parentId == null) && (ele.menuStatus==1)) {
                    child ='<ul class="treeview-menu">';
                    parent += '<li  class="treeview" ><a href="#" id="par"><i class="fa fa-dashboard"></i><span>' + ele.name + '</span><span class="pull-right-container">' +
                        '<i class="fa fa-angle-left pull-right"></i></span></a>';

                }


                parent += child;
                $.each(ele.children, function (index, ele2) {
                    if ((ele2.parentId == ele.id) &&(ele2.menuStatus==1) &&(ele.menuStatus==1)){
                        //console.log(index);
                        parent += '<li name='+ele2.sn+'><a href="' + ele2.menuUrl + '"><i class="fa fa-circle-o"></i>' + ele2.name + '</a></li>';
                        //console.log(parent);
                        console.log(ele.menuStatus);
                    }

                });
                child = '</ul>';
                parent += child;
                parent += '</li>';
                //console.log(parent);
                $('#menuList').html(parent)

            })


        }
        var cuLi = $(".treeview-menu li[name='${currentMenu}']");
        cuLi.addClass("active");
        cuLi.closest(".treeview").addClass("active");
      // console.log(tree);
        //$('#menuList').html(tree);
    });





   /* $(function () {
        //菜单初始
        // $('.sidebar-menu').tree();
        //菜单激活
        var cuLi = $(".treeview-menu li[name='${currentMenu}']");
        cuLi.addClass("active");
        cuLi.closest(".treeview").addClass("active");



    })*/
</script>


